import java.util.ArrayList;
import java.util.Arrays;

/**
 * @author zhanyin
 * @since 2021/12/29
 */
public class Solution1 {

    public static void main(String[] args) {
        int[] nums={28,8,49,85,37,90,20,8};
        int result = function(nums);
        System.out.println(result);
    }

    //暴力破解
    public static int function(int[] nums) {
        int count = 0;
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < nums.length-2; i++) {
            for (int j = i+1; j < nums.length-1; j++) {
                for (int l = j+1; l < nums.length; l++) {
                    for (int m = l+1; m < nums.length; m++) {
                        if(nums[i]+nums[j]+nums[l]==nums[m]){
                            count++;
                        }
                    }
                }
            }
        }
        return count;
    }

}
